package homework5;

import java.util.Arrays;
import java.util.Scanner;

//给定一个整数数组 nums 和一个整数目标值 target，请你在该数组中找出
// 和为目标值 target 的那两个整数，并返回它们的数组下标。
public class T5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nums = new int[6];
        while (sc.hasNextInt()) {
            for (int i = 0; i < nums.length; i++) {
                nums[i] = sc.nextInt();
            }
            int target = sc.nextInt();
            System.out.println(Arrays.toString(nums));
            int[] arr = find(nums, target);
            System.out.println(target + " = " + "nums[" + arr[0] + "]+" + "nums[" + arr[1] + "]");
        }
        sc.close();
    }

    public static int[] find(int[] nums, int target) {
        int[] arr = new int[2];
        for (int i = 0; i < nums.length; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[i] + nums[j] == target) {
                    arr[0] = i;
                    arr[1] = j;
                }
            }
        }
        return arr;
    }
}
